//
//  AccountTableViewCell.m
//  Account
//
//  Created by wanmeizty on 2016/11/29.
//  Copyright © 2016年 wanmeizty. All rights reserved.
//

#import "AccountTableViewCell.h"
#import "XMScreenAdaptation.h"
@implementation AccountTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        [self createUI];
    }
    
    return self;
    
}

- (void)createUI{
    
    CGFloat top = 10 * [XMScreenAdaptation adapterMultipleByWidth];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * [XMScreenAdaptation adapterMultipleByWidth], top, 70 * [XMScreenAdaptation adapterMultipleByWidth], 20 * [XMScreenAdaptation adapterMultipleByWidth])];
    [self.contentView addSubview:self.nameLabel];
    
    self.feeLabel = [[UILabel alloc] initWithFrame:CGRectMake(85 * [XMScreenAdaptation adapterMultipleByWidth], top, 60 * [XMScreenAdaptation adapterMultipleByWidth], 20 * [XMScreenAdaptation adapterMultipleByWidth])];
    self.feeLabel.textAlignment = NSTextAlignmentCenter;
    self.feeLabel.textColor = [UIColor redColor];
    [self.contentView addSubview:self.feeLabel];
    
    self.dateLabel = [[UILabel alloc] initWithFrame:CGRectMake(145 * [XMScreenAdaptation adapterMultipleByWidth], top, 160 * [XMScreenAdaptation adapterMultipleByWidth], 20 * [XMScreenAdaptation adapterMultipleByWidth])];
    self.dateLabel.textColor = [UIColor lightGrayColor];
    self.dateLabel.textAlignment = NSTextAlignmentRight;
    self.dateLabel.font = [UIFont systemFontOfSize:12 * [XMScreenAdaptation adapterMultipleByWidth]];
    [self.contentView addSubview:self.dateLabel];
    
    top += 20 * [XMScreenAdaptation adapterMultipleByWidth];
    
    self.descLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * [XMScreenAdaptation adapterMultipleByWidth], top, [UIScreen mainScreen].bounds.size.width - 30 * [XMScreenAdaptation adapterMultipleByWidth], 30 * [XMScreenAdaptation adapterMultipleByWidth])];
    self.descLabel.numberOfLines = 0;
//    self.descLabel.textColor = [UIColor lightGrayColor];
    self.descLabel.font = [UIFont systemFontOfSize:14 * [XMScreenAdaptation adapterMultipleByWidth]];
    [self.contentView addSubview:self.descLabel];
    
    top += 30 * [XMScreenAdaptation adapterMultipleByWidth];
    
    self.joinLabel = [[UILabel alloc] initWithFrame:CGRectMake(15 * [XMScreenAdaptation adapterMultipleByWidth], top, [UIScreen mainScreen].bounds.size.width - 30 * [XMScreenAdaptation adapterMultipleByWidth], 30 * [XMScreenAdaptation adapterMultipleByWidth])];
    self.joinLabel.numberOfLines = 0;
    self.joinLabel.font = [UIFont systemFontOfSize:14 * [XMScreenAdaptation adapterMultipleByWidth]];
    [self.contentView addSubview:self.joinLabel];
    
    
}

- (void)configTabelwithAccountModel:(AccountModel *)model{
    
    self.nameLabel.text = model.name;
    self.feeLabel.text = [NSString stringWithFormat:@"%@元",model.fee];
    self.dateLabel.text = model.date;
    self.descLabel.text = [NSString stringWithFormat:@"购买详细内容：%@",model.desc];
    self.joinLabel.text = [NSString stringWithFormat:@"参与人：%@",model.joinPerson];
}



@end
